export const option = (safe) => {
  const validateName = (rule, value, callback) => {
    const regex = /^[a-zA-Z0-9_\-\u4e00-\u9fa5:.@]{4,32}$/;
    const isValid = regex.test(value);
    if (!isValid) {
      callback(new Error('请输入中英文，并可包含数字、下划线（_）、中划线（-）、点号（.）、半角冒号（:）以及@，整体长度需控制在4至32个字符之间'));
      return;
    }
    callback();
  };
  return {
    height: 'auto',
    calcHeight: 150,
    tip: false,
    searchShow: true,
    searchMenuSpan: 6,
    border: true,
    index: true,
    viewBtn: false,
    editBtn: false,
    delBtn: false,
    selection: true,
    menuWidth: 350,
    dialogWidth: 500,
    dialogClickModal: false,
    column: [
      {
        label: "父分组",
        prop: "parentId",
        type: "tree",
        dicData: [],
        props: {
          label: "title",
        },
        hide: true,
        span: 24,
      },
      {
        label: "分组名称",
        prop: "groupName",
        type: "input",
        slot: true,
        search: true,
        rules: [{
          required: true,
          trigger: "change",
          validator: validateName
        }],
        span: 24,
      },
      {
        label: "分组备注",
        prop: "groupDesc",
        type: "textarea",
        span: 24,
      },
      {
        label: "分组排序",
        prop: "sort",
        type: "number",
        rules: [{
          required: true,
          message: "请输入分组排序",
          trigger: "blur"
        }],
        value: 99,
        width: 100,
        span: 24,
      },
      {
        label: "创建时间",
        prop: "createTime",
        type: "input",
        display: false,
        width: 180,
        span: 24,
      },
    ]
  }
}
